<?php
function smarty_function_datetimeformat($params, &$smarty){

//	var_export($params);
	
	if (!isset($params['datetime'])) {
		$smarty->trigger_error("eval: missing 'datetime' parameter");
		return;
	}
	
	if (!isset($params['format'])){
		$smarty->trigger_error("evial: missing 'format' parameter");
		return;
	}
	
	$datetime = new DateTime($params['datetime']);
	
	return $datetime->format(constant($params['format']));
}